using Domain;
using ErrorCode;
using MediatR;
using System;
using System.Collections.Generic;

namespace WriteAPI.Command.生产计划
{
    /// <summary>
    /// 获取生产计划详情命令
    /// </summary>
    public class GetProductionPlanDetailCommand : IRequest<APIResult<ProductionPlanDetailViewModel>>
    {
        /// <summary>
        /// 生产计划ID
        /// </summary>
        public int Id { get; set; }
    }

    /// <summary>
    /// 生产计划详情视图模型
    /// </summary>
    public class ProductionPlanDetailViewModel
    {
        /// <summary>
        /// 计划ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 计划编号
        /// </summary>
        public string PlanNumber { get; set; } = string.Empty;

        /// <summary>
        /// 计划主题
        /// </summary>
        public string PlanTheme { get; set; } = string.Empty;

        /// <summary>
        /// 单据日期
        /// </summary>
        public DateTime PlanDate { get; set; }

        /// <summary>
        /// 销售订单号
        /// </summary>
        public string SalesOrder { get; set; } = string.Empty;

        /// <summary>
        /// 关联项目
        /// </summary>
        public string RelatedProject { get; set; } = string.Empty;

        /// <summary>
        /// 是否不绑定销售订单
        /// </summary>
        public bool UnscheduledOrder { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; } = string.Empty;

        /// <summary>
        /// 物品明细列表
        /// </summary>
        public List<ProductionPlanDetailItem> Items { get; set; } = new List<ProductionPlanDetailItem>();

        /// <summary>
        /// 附件列表
        /// </summary>
        public List<ProductionPlanDetailAttachment> Attachments { get; set; } = new List<ProductionPlanDetailAttachment>();
    }

    /// <summary>
    /// 生产计划明细项
    /// </summary>
    public class ProductionPlanDetailItem
    {
        /// <summary>
        /// 明细ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 物品编号
        /// </summary>
        public string ItemCode { get; set; } = string.Empty;

        /// <summary>
        /// 物品名称
        /// </summary>
        public string ItemName { get; set; } = string.Empty;

        /// <summary>
        /// 规格型号
        /// </summary>
        public string Spec { get; set; } = string.Empty;

        /// <summary>
        /// 单位
        /// </summary>
        public string Unit { get; set; } = string.Empty;

        /// <summary>
        /// 物品类别
        /// </summary>
        public string ItemCategory { get; set; } = string.Empty;

        /// <summary>
        /// 物品分类
        /// </summary>
        public string ItemClass { get; set; } = string.Empty;

        /// <summary>
        /// 品牌
        /// </summary>
        public string Brand { get; set; } = string.Empty;

        /// <summary>
        /// 数量
        /// </summary>
        public decimal Quantity { get; set; }

        /// <summary>
        /// 详情日期
        /// </summary>
        public DateTime? DetailDate { get; set; }

        /// <summary>
        /// 主单位数量
        /// </summary>
        public decimal MainUnitQuantity { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; } = string.Empty;
    }

    /// <summary>
    /// 生产计划附件明细
    /// </summary>
    public class ProductionPlanDetailAttachment
    {
        /// <summary>
        /// 附件ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 文件名
        /// </summary>
        public string FileName { get; set; } = string.Empty;

        /// <summary>
        /// 文件路径
        /// </summary>
        public string FilePath { get; set; } = string.Empty;

        /// <summary>
        /// 文件大小(字节)
        /// </summary>
        public long FileSize { get; set; }

        /// <summary>
        /// 文件类型
        /// </summary>
        public string FileType { get; set; } = string.Empty;

        /// <summary>
        /// 上传时间
        /// </summary>
        public DateTime UploadTime { get; set; }
    }
} 